package com.aqie.safe.rest;

import com.aqie.safe.domain.User;
import org.springframework.web.bind.annotation.*;

import java.util.Collections;

@RestController
@RequestMapping("/api")
public class UserResource {
    // http://localhost:8080/api/greeting
    @GetMapping("/me")
    public User getProfile() {
        return User.builder()
            .name("张三")
            .password("123456")
            .roles(Collections.singletonList("USER"))
            .build();
    }

    @GetMapping("greeting")
    public String greeting(){
        return "greeting";
    }

    @PostMapping("greeting")
    public String pGreeting(String name){
        return "greeting" + name;
    }

    @PutMapping("update")
    public User updateUser(@RequestBody User user){
        return user;
    }
}
